from api.models.base_model import BaseModel

class UserModel(BaseModel):
    """用户模型"""
    
    @classmethod
    def get_table_name(cls):
        """指定表名（如果表名不是默认的users）"""
        return 'users'  # 明确指定表名
    
    # 可以添加用户特有的方法
    @classmethod
    def get_by_username(cls, username):
        """根据用户名获取用户"""
        users = cls.get_all(where="username = %s", args=(username,))
        return users[0] if users else None
    
    @classmethod
    def get_by_email(cls, email):
        """根据邮箱获取用户"""
        users = cls.get_all(where="email = %s", args=(email,))
        return users[0] if users else None